<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #box {
        width: 100px;
        padding: 10px;
        border: 1px solid #000;
        margin: 10px;
        height: 10px;
        box-sizing: content-box;
      }
      p {
        font-size: 16px;
        margin-top: 20px;
        margin-bottom: 50px;
        line-height: 1;
      }
    </style>
  </head>
  <body>
    <div id="box"></div>
    <p>AAA</p>
    <p></p>
    <p>CCC</p>
    <p></p>
    <p></p>
    <p>BBBB</p>
    <script>
      let box = document.querySelector("#box");
      console.log(box.offsetWidth);
    </script>
  </body>
</html>
